/*定义用户相关数据的ts类型*/

/*全部接口返回都拥有的数据类型*/
import { reqBaseData } from '@/api/type.ts'

//////////////////////////////////////////////////
/*登录接口需要携带的参数*/
export interface loginFromData {
  username: string
  password: string
  uuid: string
  code: string
  rememberMe: boolean
}

/*登录接口返回的数据类型*/
export interface loginResponseData extends reqBaseData {
  token: string
}

/////////////////////////////////////////////////
interface role {
  id: 1
  createTime: string
  updateTime: string
  remark: string
  name: string
  code: string
  roleKey: string
  permissions: string[]
}

/*定义userInfo返回对象*/
export interface userInfoResponseData extends reqBaseData {
  roles: string[]
  user: {
    id: number
    createTime: string
    updateTime: string
    remark: string
    username: string
    password: string
    avatar: string
    email: string
    phonenumber: string
    loginDate: string
    status: string
    roles: string
    roleList: role[]
    newPassword: string
    oldPassword: string
  }
  permissions: string[]
}

/*/////////////////////////////////////////////////////////////*/

/*定义getRouter的返回类型*/
export interface RouterItem {
  name: string
  path: string
  hidden: boolean
  redirect: string
  alwaysShow: boolean
  component: string
  meta: {
    title: string
    icon: string
    noCache: boolean
    link: string | null
  }
  children: RouterItem[]
}

export interface getRouter extends reqBaseData {
  data: RouterItem[]
}

/*//////////////////////////////////////////////////////////////////*/
/*退出登录*/
export type logoutResponseData = reqBaseData

/*验证码*/
export interface reqCode extends reqBaseData {
  uuid: string
  img: string
  captchaEnabled: boolean
}
